import Vue from 'vue'
import Router from 'vue-router'
import { getLoginType } from '@/utils/auth'

const _import = require('./_import_' + process.env.NODE_ENV)
// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/** note: submenu only apppear when children.length>=1
 *   detail see  https://panjiachen.github.io/vue-element-admin-site/#/router-and-nav?id=sidebar
 **/

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirct in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    roles: ['admin','editor']     will control the page roles (you can set multiple roles)
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
    noCache: true                if true ,the page will no be cached(default is false)
  }
**/
export const constantRouterMap = [
    { path: '/login', component: _import('login/index'), hidden: true, name: 'login', meta: { title: '登录' } },
    {
        path: '/login',
        component: Layout,
        redirect: 'noredirect',
        hidden: true,
        children: [
            { path: '/register', component: _import('login/register'), hidden: true, name: 'register', meta: { title: '注册' } }
        ]
    },
    { path: '/authredirect', component: _import('login/authredirect'), hidden: true },
    {
        path: '/authority',
        component: Layout,
        redirect: 'noredirect',
        hidden: true,
        children: [
            { path: 'index', component: _import('layout/noneTemplate/authority'), name: 'authority', meta: { title: '没有权限', icon: 'icon' } }
        ]
    },
    { path: '/404', component: _import('errorPage/404'), hidden: true },
    { path: '/401', component: _import('errorPage/401'), hidden: true },
    {
        path: '',
        component: Layout,
        redirect: 'dashboard',
        children: [{
            path: 'dashboard',
            component: _import('dashboard/index'),
            name: 'dashboard',
            meta: { icon: 'dashboard', 'title': 'dashboard', noCache: true }
        },
        { path: 'myFeedback', component: _import('dashboard/admin/components/feedback'), hidden: true, name: 'myFeedback', meta: { title: 'myFeedback' } },
        { path: 'systemUpdateLog', component: _import('dashboard/admin/components/systemUpdateLog'), hidden: true, name: 'systemUpdateLog', meta: { title: 'systemUpdateLog' } },
        { path: 'noOpen', component: _import('dashboard/admin/components/noOpen'), hidden: true, name: 'noOpen', meta: { title: 'noOpen' } },
        { path: 'repairPassword', component: _import('dashboard/admin/components/repairPassword'), hidden: true, name: 'repairPassword', meta: { title: 'repairPassword' } }

        ],
        beforeEnter: (to, from, next) => {
            const type = getLoginType()
            if (type == 1) {
                to.meta.title = 'home'
            } else {
                to.meta.title = 'dashboard'
            }
            next()
        }
    }
]

export default new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    mode: 'history',
    routes: constantRouterMap
})

export const asyncRouterMap = [

    {
        path: '/public',
        component: Layout,
        // redirect: 'noredirect',
        name: 'public',
        meta: {
            title: 'public.name',
            roles: ['root'],
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'publicList', component: _import('admin/public/publicList'), name: 'publicList', meta: { title: 'public.publicList.name', icon: 'component', noCache: true } }

        ]
    },
    {
        path: '/publicLists',
        component: Layout,
        // redirect: 'noredirect',
        name: 'publicLists',
        hidden: true,
        meta: {
            title: 'public.publicList.name',
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'addPublic', component: _import('admin/public/components/addPublic'), hidden: true, name: 'addPublic', meta: { title: 'public.publicList.addPublic', noCache: true } },
            { path: 'editPublic/:companyId', component: _import('admin/public/components/editPublic'), hidden: true, name: 'editPublic', meta: { title: 'public.publicList.editPublic', noCache: true } }

        ]
    },
    {
        path: '/feedback',
        component: Layout,
        redirect: 'noredirect',
        name: 'feedback',
        meta: {
            title: 'feedback.name',
            roles: ['root'],
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'feedbackList', component: _import('admin/feedback/feedbackList'), name: 'feedbackList', meta: { title: 'feedback.feedbackList.name', icon: 'form', noCache: true } }
        ]
    },
    {
        path: '/feedbackLists',
        component: Layout,
        redirect: 'noredirect',
        name: 'feedbackLists',
        hidden: true,
        meta: {
            title: 'feedback.feedbackList.name',
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'feedbackDetail/:feedbackId', component: _import('admin/feedback/feedbackDetail'), hidden: true, name: 'feedbackDetail', meta: { title: 'feedback.feedbackList.feedbackDetail', noCache: true } }
        ]
    },
    {
        path: '/txVideo',
        component: Layout,
        redirect: 'noredirect',
        name: 'txVideo',
        meta: {
            title: 'txVideo.name',
            roles: ['root'],
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'txVideoList', component: _import('admin/txVideo/txVideoList'), name: 'txVideoList', meta: { title: 'txVideo.txVideoList', icon: 'example', noCache: true } }
        ]
    },
    {
        path: '/inviteCard',
        component: Layout,
        redirect: 'noredirect',
        name: 'inviteCard',
        meta: {
            title: 'inviteCard.name',
            roles: ['root'],
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'inviteCardList', component: _import('admin/inviteCard/inviteCardList'), name: 'inviteCardList', meta: { title: 'inviteCard.inviteCardList.name', icon: 'tab', noCache: true } }
        ]
    },
    {
        path: '/inviteCardLists',
        component: Layout,
        redirect: 'noredirect',
        hidden: true,
        name: 'inviteCardLists',
        meta: {
            title: 'inviteCard.inviteCardList.name',
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'addBackground', component: _import('admin/inviteCard/addBackground'), hidden: true, name: 'addBackground', meta: { title: 'inviteCard.inviteCardList.addBackground', noCache: true } },
            { path: 'editBackground/:ibId', component: _import('admin/inviteCard/editBackground'), hidden: true, name: 'editBackground', meta: { title: 'inviteCard.inviteCardList.editBackground', noCache: true } }

        ]
    },
    {
        path: '/successCase',
        component: Layout,
        redirect: 'noredirect',
        name: 'successCase',
        meta: {
            title: 'successCase.name',
            roles: ['root'],
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'successCaseList', component: _import('admin/successCase/successCaseList'), name: 'successCaseList', meta: { title: 'successCase.successCaseList.name', icon: 'chart', noCache: true } }
        ]
    },
    {
        path: '/successCaseLists',
        component: Layout,
        redirect: 'noredirect',
        hidden: true,
        name: 'successCaseLists',
        meta: {
            title: 'successCase.successCaseList.name',
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'addCase', component: _import('admin/successCase/addCase'), hidden: true, name: 'addCase', meta: { title: 'successCase.successCaseList.addCase', noCache: true } },
            { path: 'editCase/:caseId', component: _import('admin/successCase/editCase'), hidden: true, name: 'editCase', meta: { title: 'successCase.successCaseList.editCase', noCache: true } }

        ]
    },
    {
        path: '/system',
        component: Layout,
        redirect: 'noredirect',
        name: 'system',
        meta: {
            title: 'system.name',
            roles: ['root'],
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'systemUpdate', component: _import('admin/system/systemUpdate'), name: 'systemUpdate', meta: { title: 'system.systemUpdate.name', icon: 'bug', noCache: true } }
        ]
    },
    {
        path: '/systemUpdates',
        component: Layout,
        redirect: 'noredirect',
        name: 'systemUpdates',
        hidden: true,
        meta: {
            title: 'system.systemUpdate.name',
            isAdmin: true,
            icon: 'component'
        },
        children: [
            { path: 'addUpdate', component: _import('admin/system/addUpdate'), hidden: true, name: 'addUpdate', meta: { title: 'system.systemUpdate.addUpdate', noCache: true } },
            { path: 'editUpdate/:upId', component: _import('admin/system/editUpdate'), hidden: true, name: 'editUpdate', meta: { title: 'system.systemUpdate.editUpdate', noCache: true } }

        ]
    },
    { // 店铺管理路由
        path: '/shopManage',
        component: Layout,
        redirect: 'noredirect',
        name: 'shopManage',
        meta: {
            title: 'shopManage.name',
            icon: 'component',
            isCompany: true
        },
        children: [
            { path: 'basicDatum', component: _import('systemManage/basicDatum/index'), name: 'basicDatum', meta: { title: 'shopManage.basicDatum', noCache: true } },
            { path: 'professionCategory', component: _import('professionCategory/index'), name: 'professionCategory', meta: { title: 'shopManage.professionCategory', noCache: true } },
            { path: 'spread', component: _import('systemManage/spread/index'), name: 'spread', meta: { title: 'shopManage.spread', noCache: true } },
            { path: 'systemManage', component: _import('systemManage/manage/index'), name: 'manage', meta: { title: 'shopManage.systemManage.name', noCache: true } },
            { path: 'createSwiper', component: _import('systemManage/manage/components/createSwiper'), hidden: true, name: 'createSwiper', meta: { title: 'shopManage.systemManage.createSwiper', noCache: true } },
            { path: 'editSwiper/:picId', component: _import('systemManage/manage/components/editSwiper'), hidden: true, name: 'editSwiper', meta: { title: 'shopManage.systemManage.editSwiper', noCache: true } },
            { path: 'createFriendLink', component: _import('systemManage/manage/components/createFriendLink'), hidden: true, name: 'createFriendLink', meta: { title: 'shopManage.systemManage.createFriendLink', noCache: true } },
            { path: 'editFriendLink/:id', component: _import('systemManage/manage/components/editFriendLink'), hidden: true, name: 'editFriendLink', meta: { title: 'shopManage.systemManage.editFriendLink', noCache: true } },
            { path: 'previewQrcode', component: _import('systemManage/manage/components/previewQrcode'), hidden: true, name: 'previewQrcode', meta: { title: 'shopManage.systemManage.previewQrcode', noCache: true } },
            { path: 'lecturers', component: _import('lecturers/index'), name: 'lecturers', meta: { title: 'shopManage.lecturers', noCache: true } },
            { path: 'accountMember', component: _import('account/index'), name: 'account', meta: { title: 'shopManage.accountMember.name', isStaff: true, noCache: true } },
            { path: 'createPermission', component: _import('account/components/addPermission'), hidden: true, name: 'addPermission', meta: { title: 'shopManage.accountMember.create', noCache: true } },
            { path: 'editPermission/:id', component: _import('account/components/editPermission'), hidden: true, name: 'editPermission', meta: { title: 'shopManage.accountMember.edit', noCache: true } },
        ]
    },
    { // 会员管理模块路由
        path: '/marketing/member',
        component: Layout,
        name: 'member',
        redirect: 'noredirect',
        meta: { title: 'marketing.member.name', icon: 'peoples', noCache: true, isCompany: true },
        children: [
            { path: 'members', component: _import('member/members'), name: 'members', meta: { title: 'marketing.member.members' } },
            { path: 'vipBenefit', component: _import('member/vipBenefit'), name: 'vipBenefit', meta: { title: 'marketing.member.vipBenefit' } }
            // { path: 'messageList', component: _import('member/messageList'), name: 'messageList', meta: { title: 'marketing.member.messageList' }}
        ]
    },
    { // 讲师管理
        path: '/lecturers',
        component: Layout,
        name: 'lecturer',
        hidden: true,
        meta: {
            title: 'shopManage.name',
            isCompany: true
        },
        children: [
            { path: 'create', component: _import('lecturers/components/createLecturer'), name: 'createLecturer', hidden: true, meta: { title: 'lecturers.create', 'noCache': true } },
            { path: ':id/edit', component: _import('lecturers/components/editLecturer'), name: 'editLecturer', hidden: true, meta: { title: 'lecturers.edit', 'noCache': true } }
        ]
    },
    { // 知识产品路由
        // path: '',
        path: '/knowledge',
        component: Layout,
        // redirect: 'noredirect',
        name: 'knowledgProduct',
        meta: {
            title: 'knowledgProduct.name',
            icon: 'form',
            isCompany: true
        },
        children: [
            // { path: 'courses/videos', component: _import('courses/index'), name: 'videos', meta: { title: 'knowledgProduct.video' } },
            // { path: 'courses/audios', component: _import('courses/index'), name: 'audios', meta: { title: 'knowledgProduct.audio' } },
            // { path: 'courses/articles', component: _import('courses/index'), name: 'articles', meta: { title: 'knowledgProduct.article' } },
            // { path: 'courses/previews', component: _import('courses/index'), name: 'previews', meta: { title: 'knowledgProduct.preview' } },
            // { path: 'columns', component: _import('courseColumn/index'), name: 'columns', meta: { title: 'knowledgProduct.columns.name', noCache: true }},
            { path: 'courseCategory', component: _import('courseCategory/index'), name: 'courseCategory', meta: { title: 'shopManage.courseCategory', noCache: true } },
            { path: 'index', component: _import('knowledge/index'), name: 'previews', meta: { title: 'knowledgProduct.main' } },
            { path: 'edit/:columnId', component: _import('courseColumn/components/editCourseColumn'), hidden: true, name: 'editCourseColumn', meta: { title: 'knowledgProduct.columns.edit' } },
            { path: 'datums', component: _import('datum/index'), name: 'datums', meta: { title: 'knowledgProduct.datums.name', enableDatumModule: true } },
            // { path: 'test', component: _import('testManage/index'), name: 'topics', meta: { title: 'knowledgProduct.test', enableExamModule: true } },
            // { path: 'resource', component: _import('resource/index'), name: 'resource', meta: { title: 'knowledgProduct.resource', enableResourceModule: true } },
            { path: 'columnsEdit', component: _import('courseColumn/columnsEdit'), hidden: true, name: 'columnsEdit', meta: { title: 'knowledgProduct.columns.columnsEdit', noCache: true } },
            { path: 'createSort', component: _import('courseColumn/components/createSort'), hidden: true, name: 'createSort', meta: { title: 'knowledgProduct.columns.createSort', noCache: true } },
            { path: 'create', component: _import('courseColumn/components/addCourseColumn'), hidden: true, name: 'create', meta: { title: 'knowledgProduct.columns.create' } }

        ]
    },
    // { // 专栏模块路由
    //     path: '/columns',
    //     component: Layout,
    //     redirect: 'noredirect',
    //     // hidden: true,
    //     name: 'column',
    //     meta: {
    //         title: 'knowledgProduct.columns.name',
    //         isCompany: true,
    //         enableColumnModule: true
    //     },
    //     children: [
    //         { path: 'columnDetail/:ColumnId', component: _import('courseColumn/components/columnDetail'), hidden: true, name: 'columnDetail', meta: { title: 'knowledgProduct.columns.columnDetail' } },
    //         { path: 'create', component: _import('courseColumn/index/addColumn'), hidden: true, meta: { title: 'knowledgProduct.columns.create' } },
    //         { path: 'edit/:columnId', component: _import('courseColumn/components/editCourseColumn'), hidden: true, name: 'editCourseColumn', meta: { title: 'knowledgProduct.columns.edit' } },
    //         { path: 'give/:ColumnId', component: _import('courseColumn/components/give'), hidden: true, name: 'give', meta: { title: 'knowledgProduct.columns.give' } },
    //         { path: 'giveList/:ColumnId', component: _import('courseColumn/components/giveList'), hidden: true, name: 'giveList', meta: { title: 'knowledgProduct.columns.giveList' } }
    //     ]
    // },
    { // 资料模块路由
        path: '/datum',
        component: Layout,
        redirect: 'noredirect',
        hidden: true,
        name: 'datum',
        meta: {
            title: 'knowledgProduct.datums.name',
            isCompany: true,
            enableDatumModule: true
        },
        children: [
            { path: 'createDatumSort', component: _import('datum/datumSort/components/addDatumSort'), hidden: true, name: 'addDatumSort', meta: { title: 'knowledgProduct.datums.createDatumSort', noCache: true } },
            { path: 'editDatumSort/:sortId', component: _import('datum/datumSort/components/editDatumSort'), hidden: true, name: 'editDatumSort', meta: { title: 'knowledgProduct.datums.editDatumSort', noCache: true } },
            { path: 'createDatum', component: _import('datum/datumDetail/components/addDatum'), hidden: true, name: 'addDatum', meta: { title: 'knowledgProduct.datums.create', noCache: true } },
            { path: 'editDatum/:datumId', component: _import('datum/datumDetail/components/editDatum'), hidden: true, name: 'editDatum', meta: { title: 'knowledgProduct.datums.edit', noCache: true } },
            { path: 'uploadDatum/:datumId', component: _import('datum/datumDetail/components/uploadDatum'), hidden: true, name: 'uploadDatum', meta: { title: 'knowledgProduct.datums.uploadDatum', noCache: true } }
        ]
    },
    { // 测评路由
        path: '/testManage',
        component: Layout,
        redirect: 'noredirect',
        name: 'testManage',
        hidden: true,
        meta: {
            title: 'testManage.name',
            isCompany: true,
            enableExamModule: true
        },
        children: [
            { path: 'paperDetail/:topicId', component: _import('testManage/topic/components/topicPaperDetail'), hidden: true, name: 'paperDetail', meta: { title: 'testManage.paperDetail' } },
            { path: 'createTopics', component: _import('testManage/topic/components/addTopics'), hidden: true, name: 'addTopic', meta: { title: 'testManage.createTopics' } },
            { path: 'editTopics/:id', component: _import('testManage/topic/components/editTopics'), hidden: true, name: 'editTopic', meta: { title: 'testManage.editTopics' } },
            { path: 'createPaper/:topicId', component: _import('testManage/paper/components/createPaper'), hidden: true, name: 'addPaper', meta: { title: 'testManage.createPaper' } },
            { path: 'editPaper/:paperId/:topicId', component: _import('testManage/paper/components/editPaper'), hidden: true, name: 'editPaper', meta: { title: 'testManage.editPaper' } },
            { path: 'subject/:paperId', component: _import('testManage/paper/components/subject'), hidden: true, name: 'subject', meta: { title: 'testManage.subject' } }
        ]
    },
    { // 互动产品路由
        path: '/interaction',
        component: Layout,
        redirect: 'noredirect',
        name: 'interaction',
        alwaysShow: true,
        meta: {
            title: 'interaction.name',
            icon: 'international',
            isCompany: true
        },
        children: [
            { path: 'social', component: _import('social/index'), name: 'social', meta: { title: 'interaction.social.name', noCache: true, enableSocialGroup: true } },
            { path: 'comment', component: _import('courses/comment'), name: 'courseComment', meta: { title: 'interaction.comment' } },

            // { // 直播
            //     path: '/activities',
            //     component: _import('activities/activitiesList'),
            //     edirect: 'noredirect',
            //     meta: {
            //         title: 'interaction.activities.name',
            //         isCompany: true,
            //         enableAgentLevels: true
            //     },
            //     children: [
            //         {
            //             path: 'sort', component: _import('activities/activitiesSort'), name: 'activitiesSort', meta: { title: 'interaction.activities.sort' }
            //         },
            //     ]
            // },
            { 
                path: '/activities',
                component: _import('activities/index'),
                edirect: 'noredirect',
                meta: {
                    title: 'interaction.activities.name',
                    isCompany: true,
                    enableAgentLevels: true
                },
                children: [
                    {
                        path: 'sort', component: _import('activities/activitiesSort'), name: 'activitiesSort', meta: { title: 'interaction.activities.sort' }
                    },
                    {
                        path: 'activities', component: _import('activities/activitiesList'), name: 'activitiesList', meta: { title: 'interaction.activities.name' }
                    },

                ]
            },
            { // 直播
                path: '/live',
                component: _import('live/index'),
                edirect: 'noredirect',
                meta: {
                    title: 'interaction.live.name',
                    isCompany: true,
                    enableAgentLevels: true
                },
                children: [
                    { path: 'index', component: _import('live/liveList'), name: 'liveList', meta: { title: 'interaction.live.liveSet' } },
                    { path: 'addPrice', component: _import('live/addPrice'), name: 'addPrice', meta: { title: 'interaction.live.priceSet' } },
                    { path: 'addLive', component: _import('live/component/addLive'), hidden: true, name: 'addLive', meta: { title: 'interaction.live.addLive', noCache: true } }
                ]
            }
        ]
    },
    { // 社群路由
        path: '/social',
        component: Layout,
        hidden: true,
        meta: {
            isCompany: true,
            enableSocialGroup: true
        },
        children: [
            { path: 'setTeacher/:socialId', component: _import('social/components/setTeacher'), hidden: true, name: 'setTeacher', meta: { title: 'interaction.social.setTeacher', noCache: true } },
            { path: 'manageSocial/:socialId', component: _import('social/components/manageSocial'), hidden: true, name: 'manageSocial', meta: { title: 'interaction.social.manageSocial', noCache: true } },
            { path: 'create', component: _import('social/components/addSocial'), hidden: true, name: 'addSocial', meta: { title: 'interaction.social.create', noCache: true } },
            { path: 'edit/:socialId', component: _import('social/components/editSocial'), hidden: true, name: 'editSocial', meta: { title: 'interaction.social.edit', noCache: true } }
        ]
    },
    { // 活动路由
        path: '/activities',
        component: Layout,
        redirect: 'noredirect',
        hidden: true,
        meta: {
            isCompany: true,
            enableActivityModule: true
        },
        children: [
            { path: 'create', component: _import('activities/components/addActivity'), hidden: true, name: 'addActivity', meta: { title: 'interaction.activities.create' } },
            { path: 'edit/:activityId', component: _import('activities/components/editActivity'), hidden: true, name: 'editActivity', meta: { title: 'interaction.activities.edit' } },
            { path: 'qrcode/:activityId', component: _import('activities/components/qrcode'), hidden: true, name: 'qrcode', meta: { title: 'interaction.activities.qrcode' } },
            { path: 'userList/:activityId', component: _import('activities/userList'), hidden: true, name: 'userList', meta: { title: 'interaction.activities.userList' } },
            { path: 'signManage/:activityId', component: _import('activities/sign'), hidden: true, name: 'signManage', meta: { title: 'interaction.activities.signManage' } },
            { path: 'enrollForm', component: _import('activities/enrollForm'), hidden: true, name: 'enrollForm', meta: { title: 'interaction.activities.enrollForm' } },
            { path: 'ticketManage', component: _import('activities/ticketManage'), hidden: true, name: 'ticketManage', meta: { title: 'interaction.activities.ticketManage' } },
            { path: 'editTicket/:ticketId', component: _import('activities/components/editTicket'), hidden: true, name: 'editTicket', meta: { title: 'interaction.activities.editTicket' } },
            { path: 'createTicket', component: _import('activities/components/addTicket'), hidden: true, name: 'addTicket', meta: { title: 'interaction.activities.createTicket' } }
        ]
    },
    { // 课程路由
        path: '/courses',
        component: Layout,
        name: 'courses',
        hidden: true,
        meta: {
            title: 'knowledgProduct.name',
            isCompany: true
        },
        beforeEnter: (to, from, next) => {
            if (to.path.indexOf('create') == -1) {
                let title = 'courses.edit'
                switch (from.name) {
                    case 'videos':
                        title = 'courses.editVideo'
                        break
                    case 'audios':
                        title = 'courses.editAudio'
                        break
                    case 'articles':
                        title = 'courses.editArticle'
                        break
                    case 'previews':
                        title = 'courses.editPreview'
                        break
                }
                to.meta.title = title
            }
            next()
        },
        children: [
            // { path: ':courseType/create', component: _import('courses/components/createCourse'), hidden: true, name: 'createCourse', meta: { title: 'courses.create', noCache: true } },
            // { path: ':courseType/:courseId/edit/:columnId', component: _import('courses/components/editCourse'), hidden: true, name: 'editCourse', meta: { title: 'courses.edit.name', noCache: true } },
            { path: ':courseId/uploadAudio', component: _import('courses/components/uploadAudio'), hidden: true, name: 'uploadAudio', meta: { title: 'courses.updateAudio', noCache: true } },
            { path: ':courseId/uploadVideo', component: _import('courses/components/uploadVideo'), hidden: true, name: 'uploadVideo', meta: { title: 'courses.uploadVideo', noCache: true } },
            { path: ':courseId/uploadVideoLeShi', component: _import('courses/components/uploadVideoLeShi'), hidden: true, name: 'uploadVideoLeShi', meta: { title: 'courses.uploadVideoLeShi' } },

            { path: 'knowledge/create', component: _import('knowledge/com/createCourse'), hidden: true, name: 'createCourse', meta: { title: 'courses.create', noCache: true } },
            { path: 'knowledge/edit', component: _import('knowledge/com/editCourse'), hidden: true, name: 'editCourse', meta: { title: 'courses.edit', noCache: true } },
            // { path: ':courseType/:courseId/edit/:columnId', component: _import('courses/components/editCourse'), hidden: true, name: 'editCourse', meta: { title: 'courses.edit.name', noCache: true } },
            // { path: ':courseId/uploadAudio', component: _import('courses/components/uploadAudio'), hidden: true, name: 'uploadAudio', meta: { title: 'courses.updateAudio', noCache: true } },
            // { path: ':courseId/uploadVideo', component: _import('courses/components/uploadVideo'), hidden: true, name: 'uploadVideo', meta: { title: 'courses.uploadVideo', noCache: true } },
            // { path: ':courseId/uploadVideoLeShi', component: _import('courses/components/uploadVideoLeShi'), hidden: true, name: 'uploadVideoLeShi', meta: { title: 'courses.uploadVideoLeShi' } }
        ]
    },
    { // 课程分类
        path: '/courseCategory',
        component: Layout,
        name: 'courseCategories',
        hidden: true,
        meta: {
            title: 'shopManage.name',
            isCompany: true
        },
        children: [
            { path: 'create', component: _import('courseCategory/components/createCategory'), hidden: true, name: 'createCategory', meta: { title: 'courseCategory.create', noCache: true } },
            { path: ':catId/edit', component: _import('courseCategory/components/editCategory'), hidden: true, name: 'editCategory', meta: { title: 'courseCategory.edit', noCache: true } },
            { path: 'list', component: _import('courses/index'), hidden: true, name: 'categories', meta: { title: 'courseCategory.list', noCache: true } }
        ]
    },
    { // 行业分类
        path: '/professionCategory',
        component: Layout,
        name: 'professionCategory',
        hidden: true,
        meta: {
            title: '',
            isCompany: true
        },
        children: [
            { path: 'create', component: _import('professionCategory/components/createCategory'), hidden: true, name: 'createProfessionCategory', meta: { title: 'professionCategory.create', noCache: true } },
            { path: ':catId/edit', component: _import('professionCategory/components/editCategory'), hidden: true, name: 'editProfessionCategory', meta: { title: 'professionCategory.edit', noCache: true } },
        ]
    },
    { // 商城路由
        path: '/mall',
        component: Layout,
        redirect: 'noredirect',
        name: 'mall',
        meta: {
            title: 'mall.name',
            icon: 'shoppingCard',
            isCompany: true,
            enableMallModule: true
        },
        children: [
            { path: 'mallInfo', component: _import('mall/mallInfo/index'), name: 'shopInfo', meta: { title: 'mall.mallInfo' } },
            { path: 'product/:catId', component: _import('mall/productList/index'), hidden: true, name: 'product', meta: { title: 'mall.product' } },
            { path: 'productList', component: _import('mall/productList/index'), name: 'productList', meta: { title: 'mall.productList' } },
            { path: 'createProduct', component: _import('mall/productList/components/addProduct'), hidden: true, name: 'addProduct', meta: { title: 'mall.createProduct' } },
            { path: 'editProduct/:productId', component: _import('mall/productList/components/editProduct'), hidden: true, name: 'editProduct', meta: { title: 'mall.editProduct' } },
            { path: 'orderList', component: _import('mall/orderList/index'), name: 'orderList', meta: { title: 'mall.orderList' } },
            { path: 'mallSetting', component: _import('mall/mallSetting/index'), name: 'mallSetting', meta: { title: 'mall.mallSetting' } },
            { path: 'createSwiper', component: _import('mall/mallSetting/components/addPic'), hidden: true, name: 'addSwiper', meta: { title: 'mall.createSwiper' } },
            { path: 'editSwiper/:id', component: _import('mall/mallSetting/components/editPic'), hidden: true, name: 'editMallSwiper', meta: { title: 'mall.editSwiper' } }
        ]
    },
    { // 咨讯路由
        path: '/news',
        component: Layout,
        redirect: 'noredirect',
        name: 'news',
        meta: {
            title: 'news.name',
            icon: 'form',
            isCompany: true,
            enableMallModule: true
        },
        children: [
            { path: 'newsCat', component: _import('news/newsCat/index'), name: 'newsCat', meta: { title: 'news.newsCat' } },
            { path: 'newsList', component: _import('news/newsList/index'), name: 'newsList', meta: { title: 'news.newsList' } }
        ]
    },
    { // 营销管理模块路由
        path: '/marketing',
        component: Layout,
        redirect: 'noredirect',
        name: 'marketing',
        meta: {
            title: 'marketing.name',
            icon: 'example',
            isCompany: true,
            isMarket: true
        },
        children: [
            /* {
              path: '/marketing/member',
              component: _import('member/index'),
              name: 'member',
              redirect: 'noredirect',
              meta: { title: 'marketing.member.name', icon: 'peoples', noCache: true },
              children: [
                { path: 'members', component: _import('member/members'), name: 'members', meta: { title: 'marketing.member.members' }},
                { path: 'vipBenefit', component: _import('member/vipBenefit'), name: 'vipBenefit', meta: { title: 'marketing.member.vipBenefit' }}
              ]
            },*/
            { // 合伙人模块路由
                path: '/marketing/partner',
                component: _import('partner/index'),
                name: 'partner',
                edirect: 'noredirect',
                meta: {
                    title: 'marketing.partner.name',
                    icon: 'documentation',
                    isCompany: true, 
                    enableAgentLevels: true
                },
                children: [
                    { path: 'partners', component: _import('partner/partners'), name: 'partners', meta: { title: 'marketing.partner.partners' } },
                    { path: 'partnerCheck', component: _import('partner/partnerCheck'), name: 'partnerCheck', meta: { title: 'marketing.partner.partnerCheck' } },
                    { path: 'extensionSetting', component: _import('partner/extensionSetting'), name: 'extensionSetting', meta: { title: 'marketing.partner.extensionSetting' } },
                    { path: 'becomeAgent', component: _import('partner/becomeAgent'), name: 'becomeAgent', meta: { title: 'marketing.partner.becomeAgent' } },
                    { path: 'giveNum/:partnerId', component: _import('partner/components/giveNum'), hidden: true, name: 'giveNum', meta: { title: 'marketing.partner.giveNum' } },
                    { path: 'partnerManage',component: _import('partner/partnerManage'), hidden: true, name: 'partnerManage', meta: { title: 'marketing.partner.partnerManage' } }
                    //推广设置

                ]
            },
            { // 积分模块路由
                path: '/marketing/point',
                component: _import('member/index'),
                name: 'point',
                edirect: 'noredirect',
                meta: {
                    title: 'marketing.point.name',
                    icon: 'chart',
                    isCompany: true,
                    enablePoints: true
                },
                children: [
                    { path: 'rank', component: _import('points/pointList/rank'), name: 'rank', meta: { title: 'marketing.point.rank' } },
                    { path: 'points/:userId', component: _import('points/pointList/index'), name: 'pointsMain', hidden: true, meta: { title: 'marketing.point.points' } },
                    { path: 'points', component: _import('points/pointList/points'), name: 'points', meta: { title: 'marketing.point.points' } },
                    { path: 'pointSetting', component: _import('points/pointSetting/index'), name: 'pointSetting', meta: { title: 'marketing.point.pointSetting' } }
                ]
            },
            //兑换管理
            {
                path: 'exchange',
                component: _import('partner/exchange'),
                name: 'exchange',
                meta: {
                    title: 'marketing.exchange.name',
                    icon: 'form'
                },
            },

            { path: 'exchangeStock', component: _import('partner/exchangeStock'), name: 'exchangeStock', hidden: true, meta: { title: 'marketing.exchange.exchangeStock' } }
            ,
            //代金券
            {
                path: 'coupon',
                component: _import('partner/coupon'),
                name: 'coupon',
                meta: {
                    title: 'marketing.coupon.name',
                    icon: 'form'
                },
            },

            // { path: 'coupon', component: _import('partner/coupon'), name: 'coupon',  meta: { title: 'marketing.exchange.exchangeStock' } }

        ]
    },
    { // 订单管理模块
        path: '/order',
        component: Layout,
        redirect: '/order/index',
        meta: { isCompany: true },
        children: [{
            path: 'index',
            component: _import('order/index'),
            name: 'order',
            meta: {
                title: 'order.name',
                icon: 'excel'
            }
        }]
    },
    { // 财务管理模块路由
        path: '/financed',
        component: Layout,
        redirect: 'noredirect',
        name: 'financed',
        meta: { title: 'financed.name', icon: 'bug', isCompany: true },
        children: [
            { path: 'cashManage', component: _import('financed/cashManage/index'), name: 'cashManage', meta: { title: 'financed.cashManage', noCache: true } },
            { path: 'companyIncome', component: _import('financed/companyIncome/index'), name: 'companyIncome', meta: { title: 'financed.companyIncome', noCache: true } },
            { path: 'userIncome', component: _import('financed/userIncome/index'), name: 'userIncome', meta: { title: 'financed.userIncome', noCache: true } },
            { path: 'business', component: _import('financed/business/index'), name: 'business', meta: { title: 'financed.business', noCache: true } },
            { path: 'investMoney', component: _import('financed/investMoney/index'), name: 'investMoney', meta: { title: 'financed.investMoney', noCache: true } },
            { path: 'investMoneyList', component: _import('financed/investMoneyList/index'), name: 'investMoneyList', meta: { title: 'financed.investMoneyList', noCache: true } },
            { path: 'investMoney/:payId', component: _import('financed/investMoney/editPresent'), hidden: true, name: 'editPresent', meta: { title: "financed.editPresent", noCache: true } },
            { path: 'downMoney', component: _import('financed/downMoney/index'), name: 'downMoney', meta: { title: 'financed.downMoney', noCache: true } },
            { path: 'downMoneyList', component: _import('financed/downMoneyList/index'), name: 'downMoneyList', meta: { title: 'financed.downMoneyList', noCache: true } }
        ]
    },

    { // 数据统计模块路由
        path: '/dataStatis',
        component: Layout,
        redirect: 'noredirect',
        name: 'dataStatis',
        meta: { title: 'dataStatis.name', icon: 'bug', isCompany: true },
        children: [
            { path: 'userStatis', component: _import('dataStatis/userStatis/index'), name: 'userStatis', meta: { title: 'dataStatis.userStatis', noCache: true } },
            { path: 'flowStatis', component: _import('dataStatis/flowStatis/index'), name: 'flowStatis', meta: { title: 'dataStatis.flowStatis', noCache: true } },
            { path: 'gooodsStatis', component: _import('dataStatis/gooodsStatis/index'), hidden: true, name: 'gooodsStatis', meta: { title: 'dataStatis.gooodsStatis', noCache: true } }
        ]
    },

    { // 小程序
        path: '/wxapp',
        component: Layout,
        redirect: 'noredirect',
        meta: {
            isCompany: true,
            enableWxapp: true
        },
        children: [
            { path: 'index', component: _import('wxapp/index'), name: 'wxapp', meta: { title: 'wxapp', icon: 'icon' } }
        ]
    },
    { path: '*', redirect: '/404', hidden: true }
]